import request from '@/utils/request'

// 合同模块的接口
export function findContract(params) {
  return request({
    url: `/online/flycare/admin/contract`,
    method: 'GET',
    params: params
  })
}

// 增加合同的接口
export function addContract(data) {
  return request({
    url: `/online/flycare/admin/contract`,
    method: 'POST',
    data: data
  })
}

// 合同失效的接口
export function invalidContract(id) {
  return request({
    url: `/online/flycare/admin/contract/${id}/status/0`,
    method: 'POST'
  })
}

// 合同生效的接口
export function validContract(id) {
  return request({
    url: `/online/flycare/admin/contract/${id}/status/1`,
    method: 'POST'
  })
}

// 查看合同详情的接口
export function checkContract(id) {
  return request({
    url: `/online/flycare/admin/contract/${id}`,
    method: 'GET'
  })
}

// 合同模块失效的接口
export function invalidModuleContract(data) {
  return request({
    url: `/online/flycare/admin/contract/module/status/0`,
    method: 'POST',
    data: data
  })
}


// 删除合同模块的接口
export function deleteContractModule(data) {
  return request({
    url: `/online/flycare/admin/contract/module`,
    method: 'delete',
    data: data
  })
}

// 删除合同的接口
export function deleteContract(uuid) {
  return request({
    url: `/online/flycare/admin/contract/${uuid}`,
    method: 'delete'
  })
}

// 修改合同模块的接口
export function editContractModule(data) {
  return request({
    url: `/online/flycare/admin/contract/module`,
    method: 'put',
    data: data
  })
}

// 修改合同的接口
export function editContract(data) {
  return request({
    url: `/online/flycare/admin/contract`,
    method: 'put',
    data: data
  })
}

// 添加合同模块的接口
export function addContractModule(data) {
  return request({
    url: `/online/flycare/admin/contract/module`,
    method: 'POST',
    data: data
  })
}

// 查看合同模块详情的接口
export function getModuleDetail(id) {
  return request({
    url: `/online/flycare/admin/contract/module/${id}`,
    method: 'GET'
  })
}

export function updateAutoRenewal(data) {
  return request({
    url: `/online/flycare/admin/contract/module/auto-renewal`,
    method: 'POST',
    data: data
  })
}

export function getDefaultEmail() {
  return request({
    url: `/online/flycare/admin/contract/default-notify-email`,
    method: 'get'
  })
}
